$(function () {
  var ps = location.search.substr(1);
  console.log(ps);
  $(".mian-bd .ep-order-tit .rmb>span").text(ps);
  function randomWord(randomFlag, min, max) {
    var str = "",
      range = min,
      arr = [
        "0",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8",
        "9",
        "A",
        "B",
        "C",
        "D",
        "E",
        "F",
        "G",
        "H",
        "I",
        "J",
        "K",
        "L",
        "M",
        "N",
        "O",
        "P",
        "Q",
        "R",
        "S",
        "T",
        "U",
        "V",
        "W",
        "X",
        "Y",
        "Z",
      ];

    // 随机产生
    if (randomFlag) {
      range = Math.round(Math.random() * (max - min)) + min;
    }
    for (var i = 0; i < range; i++) {
      pos = Math.round(Math.random() * (arr.length - 1));
      str += arr[pos];
    }
    return str;
  }
  //随机生成订单号
  const dingdan = randomWord(false, 21);
  $(".mian-bd .ep-order-tit dl>dd").text(dingdan);
  // 点击tabs栏
  $(".ep-pay-method-list-tit li").click(function () {
    $(this).addClass("xuanzhong").siblings().removeClass("xuanzhong");
    var index = $(this).index();
    $(".ep-pay-method-list-con .con").eq(index).show().siblings().hide();
  });

  //倒数
  $(".zhifu a").click(function () {
    var daosum = 3;
    //倒计时函数
    var daojishi = null;
    $(this).siblings().stop().show();
    //设置倒数的周期定时器
    daojishi = setInterval(function () {
      if (daosum <= 1) {
        clearInterval(daojishi);
        window.location = "../html/index.html";
      }
      daosum--;
      $(".daoshu").text("支付成功，页面将在" + daosum + "秒后进入首页...");
    }, 1000);
  });
});
